package operation;

import book.BookList;

import java.util.Scanner;

public class Return implements Io{
    @Override
    public void work(BookList bookList) {
        System.out.println("请输入您要归还图书名");
        Scanner sc=new Scanner(System.in);
        String name=sc.nextLine();
        int szie=bookList.getUsedSize();
        for(int i=0;i<szie;i++){
            if(bookList.getBook(i).getName().equals(name)){
                bookList.getBook(i).setBorrowed(false);
                System.out.println("归还成功");
                return;
            }
        }
        System.out.println("未找到您要归还的图书");
    }
}
